import { Controller, Post, Body, HttpCode, HttpStatus, Logger, Req } from '@nestjs/common';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { OnlyofficeService } from './onlyoffice.service';
import { Request } from 'express';

@ApiTags('Onlyoffice')
@Controller({
  path: 'onlyoffice',
})
export class OnlyofficeController {
  constructor(private onlyofficeService: OnlyofficeService) {}

  // onyoffcie server 文件回调
  @Post('callback')
  @HttpCode(HttpStatus.OK)
  async callback(@Req() req: Request): Promise<any> {
    // Logger.log(req.body, req.headers);
    return await this.onlyofficeService.callback(req);
  }
}
